from tools import all_flow_ILAE_1400, all_flow_ILAE_1401, all_flow_ILAE_1404, all_flow_ILAE_1405, all_flow_ILAE_1406_1, \
    all_flow_ILAE_1406_2, all_flow_ILAE_1406_3, all_flow_ILAE_1406_4, all_flow_ILAE_1407, all_flow_ILAE_1408, \
    all_flow_ILAE_1409, all_flow_ILAE_1410, all_flow_ILAE_1411, all_flow_ILAE_1412, all_flow_ILAE_1413, \
    all_flow_ILAE_1414
from global_parameter import ip, port, username, DB_NAME

channel_2v2_scene1 = [
    "1, 1, 1, 1, '1', 5, '1', 2, '2023-07-29 17:00:55', NULL, '', 15, '', '1', NULL, NULL, NULL",
    "2, 1, 2, 2, '2', 5, '1', 2, '2023-07-29 17:00:55', NULL, '', 15, '', '1', NULL, NULL, NULL",
    "3, 1, 3, 100, '100', 4, '1', 2, '2023-07-29 17:00:55', NULL, '', 15, '', '1', NULL, NULL, NULL",
    "4, 1, 4, 101, '101', 4, '1', 2, '2023-07-29 17:00:55', NULL, '', 15, '', '1', NULL, NULL, NULL"]

no_group_2v2 = [
    "1, 1, 5, 1",
    "1, 2, 5, 1",
    "1, 100, 4, 1",
    "1, 101, 4, 1"]

# 通用算法
algo_scene = [
    "4, '1', '1', '1,3', '0', '', '0', NULL, '2023-04-14 11:44:50', NULL, NULL, NULL, NULL, NULL, 7, 14, 7, 14, '0', '0', '1'"]

"""
330kV电压等级对应的字典键值(8)  330kV电压等级线路数  330kV电压等级同源标志(True  False)  330kV电压等级分列标志(True  False)  330kV电压等级停电标志(True  False) 
220kV电压等级对应的字典键值(5)  220kV电压等级线路数  220kV电压等级同源标志(True  False)  220kV电压等级分列标志(True  False)  220kV电压等级停电标志(True  False) 
110kV电压等级对应的字典键值(4)  110kV电压等级线路数  110kV电压等级同源标志(True  False)  110kV电压等级分列标志(True  False)  110kV电压等级停电标志(True  False) 
10kV 电压等级对应的字典键值(3)  10kV 电压等级线路数  10kV 电压等级同源标志(True  False)  10kV 电压等级分列标志(True  False)  10kV 电压等级停电标志(True  False) 
"""
v_arg_2v2_gao_bing_di_bing = [8, 0, False, False, False,
                              5, 2, False, False, False,
                              4, 2, False, False, False,
                              3, 0, False, False, False]

# ILAE-1400 电压数据丢失_某时刻缺失数据触发
all_flow_ILAE_1400(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1400", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1401 电压数据丢失_关闭采集单元触发
all_flow_ILAE_1401(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1401", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-60, 60])

# # ILAE-1402 电压数据丢失_X86掉电3分钟触发
# # todo 需要控制断电，暂时无法模拟

# # ILAE-1403 电压数据丢失_恢复_数据恢复
# # todo 需要重新打开采集单元，单纯在数据库中打开无效，需要连接采集单元，无法单独模拟
# all_flow_ILAE_1403(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1403", channel_2v2_scene1,
#                    no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
#                    time_data=[-60, 60])

# ILAE-1404 电压数据丢失_恢复_线路删除
all_flow_ILAE_1404(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1404", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-60, 60])

# ILAE-1405 电压数据重复_某分钟存在通道1的2条采集数据触发
all_flow_ILAE_1405(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1405", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1406 电压数据幅值异常_幅值调整触发&恢复
all_flow_ILAE_1406_1(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1406_1", channel_2v2_scene1,
                     no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                     time_data=[-25, 70])

# ILAE-1406 电压数据幅值异常_幅值调整触发&恢复
all_flow_ILAE_1406_2(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1406_2", channel_2v2_scene1,
                     no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                     time_data=[-25, 70])

# ILAE-1406 电压数据幅值异常_幅值调整触发&恢复
all_flow_ILAE_1406_3(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1406_3", channel_2v2_scene1,
                     no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                     time_data=[-25, 70])

# ILAE-1406 电压数据幅值异常_幅值调整触发&恢复
all_flow_ILAE_1406_4(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1406_4", channel_2v2_scene1,
                     no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                     time_data=[-25, 70])

# ILAE-1407 电压数据幅值异常_幅值调整触发&删除线路恢复
all_flow_ILAE_1407(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1407", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1408 电压数据幅值异常_任意单相触发检查
all_flow_ILAE_1408(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1408", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1409 电压频率异常_频率调整触发&恢复
all_flow_ILAE_1409(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1409", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1410 电压频率异常_频率值调整触发&删除线路恢复
all_flow_ILAE_1410(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1410", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1411 电压频率值异常_任意单相触发检查
all_flow_ILAE_1411(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1411", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1412 电压线路停电_幅值调整触发&恢复
all_flow_ILAE_1412(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1412", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1413 电压频率异常_频率值调整触发&删除线路恢复
all_flow_ILAE_1413(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1413", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])

# ILAE-1414 电压频率值异常_三相同时触发检查
all_flow_ILAE_1414(ip, DB_NAME, v_arg_2v2_gao_bing_di_bing, "ILAE-1414", channel_2v2_scene1,
                   no_group_2v2, algo_scene, [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150],
                   time_data=[-25, 70])
